In the latter half of the twentieth century, there began a phenomenon known as the information revolution. While the information revolution is a historical development broader in scope than any one event or machine, no single device has come to represent the information revolution more than the digital electronic computer. The development of computer systems has surely been a revolution. Each year, computer systems grow faster, store more data, and provide more applications to their users.
A modern computer system typically comprises one or more central processing units (CPU) and supporting hardware necessary to store, retrieve and transfer information, such as communication buses and memory. It also includes hardware necessary to communicate with the outside world, such as input/output controllers or storage controllers, and devices attached thereto such as keyboards, monitors, tape drives, disk drives, communication lines coupled to a network, etc. The CPU or CPUs are the heart of the system. They execute the instructions which form a computer program and directs the operation of the other system components.
From the standpoint of the computer's hardware, most systems operate in fundamentally the same manner. Processors are capable of performing a limited set of very simple operations, such as arithmetic, logical comparisons, and movement of data from one location to another. But each operation is performed very quickly. Sophisticated software at multiple levels directs a computer to perform massive numbers of these simple operations, enabling the computer to perform complex tasks. What is perceived by the user as a new or improved capability of a computer system is made possible by performing essentially the same set of very simple operations, but using software with enhanced function, along with faster hardware.
In the very early history of the digital computer, computer programs which instructed the computer to perform some task were written in a form directly executable by the computer's processor. Such programs were very difficult for a human to write, understand and maintain, even when performing relatively simple tasks. As the number and complexity of such programs grew, this method became clearly unworkable. As a result, alternate forms of creating and executing computer software were developed. In particular, a large and varied set of high-level languages was developed for supporting the creation of computer software.
Typically, high-level languages represent instructions, fixed values, variables, and other constructs in a manner readily understandable to the human programmer rather than the computer. Such programs are not directly executable by the computer's processor. In order to run on the computer, the programs must first be transformed from a human-readable form (source code) to something executable by the computer. In general, source code is universal and understandable by anyone trained to use the applicable language, while executable code is specific to a particular computer system environment (model of hardware, operating system, etc.), and can only execute on that computer system or one similarly configured.
The fundamental purpose of high-level languages is to make it easier for humans to write programs to perform useful work. A high-level language does not, in general, increase the efficient utilization of machine resources. The continual decline in the cost of machine resources vis-a-vis human resources makes it imperative that development efforts concentrate on the efficient use of human resources. Accordingly, forty years of high-level language evolution have not produced executable programs which are more efficient, from the standpoint of using machine resources, than code produced using older techniques. On the contrary, code produced from modern high-level languages tends to be significantly less efficient in its use of machine resources. Although efficient use of human resources must command a higher priority than efficient machine resource utilization, there is still a motivation to improve the efficiency of machine resource utilization, provided that this can be done without adversely affecting the utilization of human resources. Specifically, there is a motivation to improve the efficiency of machine resource utilization in code generated from a high-level language, without changing the semantics of the language or requiring manual intervention by the programmer.
One of the many ways in which high-level languages favor the utilization of human resources over machine resources is in the representation of numeric data. Digital computer hardware is binary in nature, and the most natural way for a computer to represent numbers is in an exclusively binary format. However, in most human cultures, numbers are represented in base ten. Many high level languages support one or more base ten numeric representations which, although not necessarily the most machine-efficient, are easier for humans to manipulate and understand.
A common base ten numeric representation is a packed decimal format (also called “binary coded decimal”). In packed decimal format, a number is represented in a series of 8-bit bytes, where four bits of every byte are allocated to a single decimal digit, allowing each byte to represent two decimal digits. One of the 4-bit patterns is allocated to a sign (positive or negative). A packed decimal number can be of any specified length, up to a limit imposed by the applicable language, with an implicit decimal point assumed at some fixed location. Packed decimal format has the advantage of supporting the representation of “exact” numbers over a large range, without rounding inaccuracies. It is thus useful in many accounting and other business applications.
Processor arithmetic using numeric representations in packed decimal format is much less efficient than arithmetic using binary representations. Even simple addition is complicated by the need to propagate carries from one digit to the next. Multiplication and division using packed decimal representations are far more complex, and are typically performed using relatively lengthy library routines. It would be desirable to find more machine-efficient techniques for performing arithmetic using packed decimal numeric representation.
Modern processors contain hardware support for a variety of arithmetic operations using different data types. Recently, an IEEE standard (draft standard IEEE 754R) has been proposed for operations on a Decimal Floating Point (DFP) format. As used herein, “DFP” refers specifically to a decimal floating point format according to the IEEE 754R draft standard, or to any revision or successor thereof. It is anticipated that newer processor designs will include the capability to perform operations on these data types in hardware. Inclusion of hardware support for DFP format would make operations on this type of data relatively fast and efficient, significantly faster than operations on packed decimal data.
DFP is intended for different uses than packed decimal format. The decimal digits are encoded using a different, more compact representation. Unlike packed decimal, DFP format is a floating point format in which arithmetic operations can produce rounding errors. However, DFP does support a large number of (up to 34) decimal digits of precision.
Although not generally recognized in the art, certain operations conventionally performed using packed decimal arithmetic could alternatively be performed using DFP arithmetic. Use of DFP arithmetic would enable the operations to be performed using processor hardware designed for DFP operations, achieving a substantial increase in machine efficiency. It would be possible for a programmer to manually convert packed decimal representations to DFP representations where appropriate, performing corrective action to assure proper treatment of rounding and other issues. However, such a conversion would be a substantial burden on the programmer (a substantial cost of human resources), and would contravene the general principle that human resources are to be given a higher priority than machine resources. An unrecognized need therefore exists for an automated method which will, in appropriate cases, substitute DFP operations for packed decimal operations.